package com.controller;

import cn.com.webxml.ArrayOfString;
import cn.com.webxml.WeatherWebService;
import cn.com.webxml.WeatherWebServiceSoap;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class getNowWeath {

    @ResponseBody
    @RequestMapping("/getNowWearth")
    private ArrayOfString getNowWearth(String name) {
        //创建实例化对象
        WeatherWebService weatherWS = new WeatherWebService();
        //通过实例化对象创建接口
        WeatherWebServiceSoap serviceSoap = weatherWS.getWeatherWebServiceSoap();
        //传入城市，获取当前城市天气状况
        ArrayOfString arr = serviceSoap.getWeatherbyCityName(name);
        //if (null != arr) {
        //    //获取到对象转换成集合遍历
        //    for (String message: arr.getString()) {
        //        System.out.println(message);
        //    }
        //}
        return arr;
    }
}
